package zy.blogs.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zy.blogs.entity.Order;
import zy.blogs.mapper.OrderMapper;

import java.util.List;
@Service
public class OrderService extends ServiceImpl<OrderMapper, Order> {
    OrderMapper mapper;
    @Autowired
    public OrderService(OrderMapper mapper){
        this.mapper=mapper;
    }
    public List<Order> getAll(){
        List<Order> results=mapper.getAll();
        return results;
    }
    public boolean insert(Order entity){
        boolean result=mapper.insert(entity)>0?true:false;
        return result;
    }

    public boolean update(Order entity){
        boolean result=mapper.update(entity)>0?true:false;
        return result;
    }
    public Order getById(Long id){
        Order result=mapper.getById(id);
        return result;
    }
    public boolean delete(Order entity){
        int result=mapper.deleteById(entity);
        return result>0?true:false;
    }
}
